import Vue from 'vue'
import App from './App'
import router from './router'
import VueRouter from 'vue-router'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import axios from 'axios'
import Vuex from 'vuex'
import store from './store/index'

// 使用vue-router
Vue.use(VueRouter);
// 使用element-ui
Vue.use(ElementUI);
Vue.use(Vuex);
Vue.prototype.axios = axios;


Vue.config.productionTip = false

// router.beforeEach((to, from, next) =>{
//   let isLogin = sessionStorage.getItem('isLogin');
//   if (to.path == '/logout'){
//     // 清空
//     sessionStorage.clear();
//     // 跳转到登录
//     next({path:'/login'});
//   }else if (to.path=='/login'){
//     // 登录过直接到后台主页
//     if (isLogin != null){
//       next({path:'/main'});
//     }
//   }else if (to.path=='/content'){
//     next({path:'/content'});
//   } else if (isLogin == null){
//     next({path:'/login'});
//   }
//   next();
// })

new Vue({
  router,
  ElementUI,
  store,
  render: h => h(App),
}).$mount('#app')